package com.yeping.controller;

import com.yeping.domain.ResponseResult;
import com.yeping.domain.dto.AddCommentDto;
import com.yeping.domain.entity.Article;
import com.yeping.domain.entity.Comment;
import com.yeping.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/comment")
public class CommentController {
    @Autowired
    private CommentService commentService;

    @PutMapping
    public ResponseResult update(@RequestBody Comment comment){
        return commentService.updateComment(comment);
    }

    @GetMapping("/commentList")
    public ResponseResult getCommentList(Integer pageNum, Integer pageSize, String content){
        return commentService.commonList(null,null,pageNum,pageSize,content);
    }

    @DeleteMapping("/{id}")
    public ResponseResult deleteComment(@PathVariable Long id){
        return commentService.deleteComment(id);
    }

    @PostMapping("/del/batch")
    public ResponseResult delBatchUser(@RequestBody List<Long> ids){
        return commentService.delBatchComment(ids);
    }
}
